/*
 *    Copyright (c) 2018-2025, boss All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the boss developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: boss
 */

package com.hopes.bizz.poll.map.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hopes.bizz.poll.map.entity.PollMapParamEntity;
import com.hopes.bizz.poll.map.service.PollMapParamService;
import com.hopes.boss.common.core.util.R;
import com.hopes.boss.common.log.annotation.SysLog;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * 地图模型参数
 *
 * @author daijie
 * @date 2023-06-06 14:58:15
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/map" )
@Tag(description = "map" , name = "地图模型参数管理" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class PollMapParamController {

    private final PollMapParamService pollMapParamService;

    /**
     * 查询地图模型参数
     * @param pollMapParam 地图模型参数
     * @return
     */
    @Operation(summary = "查询" , description = "查询" )
    @GetMapping()
    @PreAuthorize("@pms.hasPermission('poll_map_view')" )
    public R getPollMapParamPage(PollMapParamEntity pollMapParam) {
        LambdaQueryWrapper<PollMapParamEntity> wrapper = Wrappers.lambdaQuery();
        return R.ok(pollMapParamService.getOne(wrapper));
    }

    /**
     * 修改地图模型参数
     * @param pollMapParam 地图模型参数
     * @return R
     */
    @Operation(summary = "修改地图模型参数" , description = "修改地图模型参数" )
    @SysLog("修改地图模型参数" )
    @PutMapping
    @PreAuthorize("@pms.hasPermission('poll_map_edit')" )
    public R updateById(@RequestBody PollMapParamEntity pollMapParam) {
        return R.ok(pollMapParamService.updateById(pollMapParam));
    }

//    /**
//     * 通过id查询地图模型参数
//     * @param id id
//     * @return R
//     */
//    @Operation(summary = "通过id查询" , description = "通过id查询" )
//    @GetMapping("/{id}" )
//    @PreAuthorize("@pms.hasPermission('map_map_view')" )
//    public R getById(@PathVariable("id" ) Long id) {
//        return R.ok(pollMapParamService.getById(id));
//    }
//    /**
//     * 分页查询
//     * @param page 分页对象
//     * @param pollMapParam 地图模型参数
//     * @return
//     */
//    @Operation(summary = "分页查询" , description = "分页查询" )
//    @GetMapping("/page" )
//    @PreAuthorize("@pms.hasPermission('map_map_view')" )
//    public R getpollMapParamPage(Page page, PollMapParamEntity pollMapParam) {
//        LambdaQueryWrapper<PollMapParamEntity> wrapper = Wrappers.lambdaQuery();
//        return R.ok(pollMapParamService.page(page, wrapper));
//    }
//    /**
//     * 新增地图模型参数
//     * @param pollMapParam 地图模型参数
//     * @return R
//     */
//    @Operation(summary = "新增地图模型参数" , description = "新增地图模型参数" )
//    @SysLog("新增地图模型参数" )
//    @PostMapping
//    @PreAuthorize("@pms.hasPermission('map_map_add')" )
//    public R save(@RequestBody PollMapParamEntity pollMapParam) {
//        return R.ok(pollMapParamService.save(pollMapParam));
//    }
//    /**
//     * 通过id删除地图模型参数
//     * @param ids id列表
//     * @return R
//     */
//    @Operation(summary = "通过id删除地图模型参数" , description = "通过id删除地图模型参数" )
//    @SysLog("通过id删除地图模型参数" )
//    @DeleteMapping
//    @PreAuthorize("@pms.hasPermission('map_map_del')" )
//    public R removeById(@RequestBody Long[] ids) {
//        return R.ok(pollMapParamService.removeBatchByIds(CollUtil.toList(ids)));
//    }

}